defmodule SpaceAge do
  @type planet ::
          :mercury
          | :venus
          | :earth
          | :mars
          | :jupiter
          | :saturn
          | :uranus
          | :neptune

  @doc """
  Return the number of years a person that has lived for 'seconds' seconds is
  aged on 'planet'.
  """
  @sec_in_day (60 * 60 * 24)
  @spec age_on(planet, pos_integer) :: float
  def age_on(planet, seconds) do
    #IO.inspect planet
    #IO.inspect seconds
    case planet do
      :mercury -> seconds / (@sec_in_day * 87.969)
      :venus   -> seconds / (@sec_in_day * 224.701)
      :earth   -> seconds / (@sec_in_day * 365.25)
      :mars    -> seconds / (@sec_in_day * 686.971)
      :jupiter -> seconds / (@sec_in_day * 4332.59)
      :neptune -> seconds / (@sec_in_day * 60182)
      :uranus  -> seconds / (@sec_in_day * 30688.5)
      :saturn  -> seconds / (@sec_in_day * 10759.22)
    end

  end
end


